<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script>
    function changeNum() {
        // var OBJ = document.getElementsByName("num");
        //
        // var set = []
        //  OBJ.forEach(n => {
        //     if (n.checked){
        //         set.push(n.value)
        //     }
        // })
        // console.log(set)

        var str = document.getElementById("qwe").value;
        alert(str);


    }


</script>
<body>

<input type="checkbox" name="num" value="1" id="in1">张三
<input type="checkbox" name="num" value="2">李四
<input type="checkbox" name="num" value="3">王五
<input type="button" value="选择" onclick="changeNum()">

<textarea id="qwe">666</textarea>
</body>
</html>